<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <style>
        @page {
            size: 279mm 200mm;
        }

        body {
            font-family: SimSun;
            font-size: 10px;
        }


        .headTitle {
            height: 41px;
            font-size: 15px;
        }

        /* 为表格设置合并边框模型:{border-collapse: collapse;} 实现细边框。[注:如果没有规定 !DOCTYPE,则 border-collapse 可能产生意想不到的结果。] */
        .demo3 {
            border: 1px solid #1c1a1a;
            border-collapse: collapse;
        }

        .demo3 th, .demo3 td {
            border: 0.5px solid #1c1a1a;
            padding: 3px; /* 在单元格内部添加间距 */
        }

    </style>
</head>
<body>
<#escape x as x?html>
<#--    <div style="margin-top:0;border: 2px solid #ff0000;">-->
    <div style="margin-top:0;">
        <#--每页展示几条分录行-->
        <#assign size=5 />

        <!-- 头部数据行列宽设置 -->
        <#assign columnt1= 40  />
        <#assign columnt3= 30  />
        <#assign columnt2= 100 - columnt1 - columnt3/>

        <#--凭证日期处理-----=start=----->
        <#assign voucherDateStr = "" >
        <#if voucherDate?exists>
            <#if voucherDate?is_number || voucherDate?is_date>
                <#assign voucherDate = (voucherDate?string('yyyy-MM-dd')) >
            </#if>
            <#assign voucherDate = voucherDate?split("-") >
            <#if ( voucherDate?size > 2)>
                <#assign voucherDateStr = voucherDate[0] + "." +voucherDate[1]+ "." + voucherDate[2]>
            </#if>
        </#if>
        <#--凭证日期处理-----=end=----->

        <#--计算全量行的借方合计-----begin----->
        <#assign qtAllTotal=0 />
        <#if debitAmountTotal?exists  >
            <#assign qtAllTotal = debitAmountTotal >
        <#else>
            <#if lines?exists >
                <#list 0..lines?size-1 as i>
                    <#assign qtAllTotal +=lines[i].debitAmount >
                </#list>
            </#if>
        </#if>
        <#--计算全量行的借方合计-----=end=----->

        <#if lines?exists >

        <#--计算全量行数-----begin----->
            <#assign pageTotal = 0 />
            <#if lineTotal?exists  >
                <#assign pageTotal = (lineTotal/size)?ceiling >
            <#else>
                <#assign pageTotal = (lines?size/size)?ceiling  >
            </#if>
        <#--计算全量行数-----=end=----->


            <#assign jfTotal=0 />
            <#assign dfTotal=0 />
            <#assign page=(lines?size/size)?ceiling />
            <#list 1..page as c>
                <div <#if c != page >style="page-break-after:always;"</#if>>
                    <#if c*size gt lines?size>
                        <#assign end=lines?size-1 />
                    <#else>
                        <#assign end=c*size-1 />
                    </#if>
                    <#--计算当前页码-----begin----->
                    <#assign nowPageNo = 0 />
                    <#if lines?exists && (lines?size > end) &&  lines[end].templateSequenceNo?exists >
                    <#--获取当前页的最后一行----->
                        <#assign nowPageNo = ((lines[end].templateSequenceNo)  / size)?ceiling  >
                    <#else>
                        <#assign nowPageNo = c >
                    </#if>
                    <#--计算当前页码-----=end=----->


                    <div style="width:100%;text-align:center">
                        <div style="height: 0px">
                            <#-- 顶部留空站位----->
                        </div>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr style="height: 20px">
                                <td width="38%"></td>
                                <td>
                                    <span style="font-size: 35px;">记&nbsp;账&nbsp;凭&nbsp;证</span>
                                    <#--<br/><span style="font-size: 8px" >借方合计：${debitAmountTotal!""};贷方合计：${creditAmountTotal!""}</span>
                                    <br/><span style="font-size: 8px" >总页码((lineTotal/size)?ceiling)：【lineTotal：总行数${lineTotal!""} / 单页显示${size!""} 】</span>
                                    <br/><span style="font-size: 8px" >当前页【(((lines[end].templateSequenceNo) + size -1 ) / size)?ceiling -1】：【当前页最后一行行号${lines[end].templateSequenceNo!""} / 单页显示${size!""} 】</span>-->
                                    <#--<#if lineTotal?exists  >
                                        ${ nowPageNo }
                                    </#if>-->
                                </td>
                                <td width="38%">
                                </td>
                            </tr>
                            <tr style="height: 8px">
                            </tr>
                            <tr style="height: 7px">
                                <td></td>
                                <td style="border-top: 1px solid #1c1a1a;border-bottom: 1px solid #1c1a1a;">
                                </td>
                                <td>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="line-height:12px">
                        <colgroup>
                            <col text-align="left" width="${columnt1}%"/>
                            <col text-align="left" width="${columnt2}%"/>
                            <col text-align="left" width="${columnt3}%"/>
                        </colgroup>
                        <tbody>
                        <tr style="height: 8px;">
                        </tr>
                        <#assign voucherNoTmp = "" >
                        <#if custom?exists>
                            <#if custom.XBLNR_ALT?exists>
                                <#assign voucherNoTmp = custom.XBLNR_ALT >
                            </#if>
                        </#if>
                        <tr>
                            <td>公司名称：${businessEntityName!""}</td>
                            <td style="text-align: center">
                                ${voucherDateStr!""}&nbsp;凭证编码：${voucherNo!""}
                                <#if voucherNoTmp?exists && "" != voucherNoTmp>
                                    (${voucherNoTmp!""})
                                </#if>
                            </td>
                            <td style="text-align: right">
<#--                                ${nowPageNo?string('0')}&nbsp;&nbsp;/${page}&nbsp;&nbsp;-->
                                ${nowPageNo?string('0')}&nbsp;&nbsp;/${pageTotal?string('0')}&nbsp;&nbsp;
                            </td>
                        </tr>
                        <tr style="height: 10px;"/>
                        </tbody>
                    </table>
                    <div width="100%">
                        <table width="100%" border="0.5" cellspacing="0" cellpadding="0" class="demo3"
                               style="font-size:10px;text-align:center;border-collapse:collapse;">
                            <colgroup>
                                <col width="12%"/>
                                <col width="13%"/>
                                <col width="25%"/>
                                <col width="8%"/>
                                <col width="14%"/>
                                <col width="14%"/>
                                <col width="14%"/>
                            </colgroup>
                            <thead>
                            <tr class="headTitle">
                                <td text-align="center" rowspan="2" colspan="2"><b>摘要</b></td>
                                <td text-align="center" rowspan="2"><b>科目</b></td>
                                <td text-align="center" style=" border-left: 1px solid #1c1a1a;"><b>币别</b></td>
                                <td text-align="center"><b>原币金额</b></td>
                                <td text-align="center" rowspan="2"><b>借方</b></td>
                                <td text-align="center" rowspan="2"><b>贷方</b></td>
                            </tr>
                            <tr class="headTitle">
                                <td text-align="center" style=" border-left: 1px solid #1c1a1a;"><b>单位</b></td>
                                <td text-align="center"><b>数量</b></td>
                            </tr>
                            </thead>
                            <tbody>
                            <#assign forLineHeight = 41 />
                            <#list (c-1) * size..end as i>
                                <#assign line=lines[i] />
                                <tr style="height: ${forLineHeight!""}px">
                                    <td style="text-align:left;" rowspan="2" colspan="2">${line.voucherAbstract!""}</td>
                                    <td style="text-align:left;" rowspan="2">
                                        ${line.subjectName!""}
                                    </td>
                                    <td style="text-align:left; border-left: 1px solid #1c1a1a;">
                                        ${line.currency!""}
                                    </td>
                                    <td style="text-align:right;">
                                        <#if line.originalAmount?exists>
                                            <#assign tmpNumber = line.originalAmount >
                                            <#if 0 != tmpNumber >
                                                <#if tmpNumber gt 1000>
                                                    ${tmpNumber?string('0,000.00')}
                                                <#else >
                                                    ${tmpNumber?string('0.00')}
                                                </#if>
                                            </#if>
                                        </#if>
                                    </td>
                                    <td style="text-align:right;" rowspan="2">
                                        <#if line.debitAmount?exists>
                                            <#assign tmpNumber = (line.debitAmount) >
                                            <#if 0 != tmpNumber >
                                                <#if tmpNumber gt 1000>
                                                    ${tmpNumber?string('0,000.00')}
                                                <#else >
                                                    ${tmpNumber?string('0.00')}
                                                </#if>
                                            </#if>
                                            <#assign jfTotal += tmpNumber >
                                        </#if>
                                    </td>
                                    <td style="text-align:right;" rowspan="2">
                                        <#if line.creditAmount?exists>
                                            <#assign tmpNumber = (line.creditAmount) >
                                            <#if 0 != tmpNumber >
                                                <#if tmpNumber gt 1000>
                                                    ${tmpNumber?string('0,000.00')}
                                                <#else >
                                                    ${tmpNumber?string('0.00')}
                                                </#if>
                                            </#if>
                                            <#assign dfTotal += tmpNumber >
                                        </#if>
                                    </td>
                                </tr>
                                <tr style="height: ${forLineHeight!""}px">
                                    <td style="text-align:left; border-left: 1px solid #1c1a1a;">
                                        <#if line.custom?exists>
                                            <#if line.custom.MEINS?exists>
                                                ${line.custom.MEINS}
                                            </#if>
                                        </#if>
                                    </td>
                                    <td style="text-align:right;">
                                        <#if line.quantity?exists>
                                            <#assign tmpNumber = (line.quantity) >
                                            <#if 0 != tmpNumber >
                                                <#if tmpNumber gt 1000>
                                                    ${tmpNumber?string('0,000.00')}
                                                <#else >
                                                    ${tmpNumber?string('0.00')}
                                                </#if>
                                            </#if>
                                        </#if>
                                    </td>
                                </tr>
                            </#list>
                            <#assign lastPageMark = (nowPageNo == page) />
                            <#if lastPageMark>
                                <!--==========================补充空行=============begin==========================-->
                                <#assign emptyLineNum = lines?size - (c-1)*size />
                                <#if 0 != emptyLineNum>
                                    <#list 1 .. (size - emptyLineNum) as i>
                                        <tr style="height: ${forLineHeight!""}px">
                                            <td style="text-align:left;" rowspan="2"  colspan="2">
                                                <#--   总行数：${ lines?size}
                                                   最后一页显示 ${emptyLineNum}行
                                                   当前页码：${nowPageNo}，总页码：${page}-->
                                            </td>
                                            <td style="text-align:left;" rowspan="2"></td>
                                            <td style="text-align:left; border-left: 1px solid #1c1a1a;"></td>
                                            <td style="text-align:right;"></td>
                                            <td style="text-align:right;" rowspan="2"></td>
                                            <td style="text-align:right;" rowspan="2"></td>
                                        </tr>
                                        <tr style="height: ${forLineHeight!""}px">
                                            <td style="text-align:left; border-left: 1px solid #1c1a1a;"></td>
                                            <td style="text-align:right;"></td>
                                        </tr>
                                    </#list>
                                </#if>
                                <!--==========================补充空行=============end ==========================-->
                            </#if>
                            <tr style="height:41px">
                                <td style="text-align:left;">
                                    附单据：
                                </td>
                                <td style="text-align:left;">
                                    <#if attachmentsNumber?exists>
                                        ${attachmentsNumber?string("000")}
                                    </#if>
                                    张
                                </td>
                                <td style="text-align:left;" colspan="3">
                                    合计：
                                    <#if lastPageMark && totalUppercase?exists>
                                        ${totalUppercase}
                                    </#if>
                                </td>
                                <td style="text-align:right; ">
                                    <#if  lastPageMark && jfTotal?exists>
                                        ${jfTotal}
                                    </#if>
                                </td>
                                <td style="text-align:right;">
                                    <#if  lastPageMark && dfTotal?exists>
                                        ${dfTotal}
                                    </#if>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div style="margin-top:5px;">
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <colgroup>
                                <col width="27%"/>
                                <col width="29%"/>
                                <col width="26%"/>
                                <col/>
                            </colgroup>
                            <tbody>
                            <tr style="height: 10px">
                                <td style="text-align:left">&nbsp;会计主管：
                                    <#if custom?exists>
                                        <#if custom.ZFIT00220_ZRYGW_01?exists>
                                            ${custom.ZFIT00220_ZRYGW_01}
                                        </#if>
                                    </#if>
                                </td>
                                <td style="text-align:left">&nbsp;审核：${reviewer!""}</td>
                                <td style="text-align:left">&nbsp;出纳：${cashier!""}</td>
                                <td style="text-align:left">&nbsp;制单：${preparedBy!""}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

            </#list>
        </#if>
    </div>
</#escape>
</body>
</html>
